package HTMLParser;

import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class HTMLParserExample4 {

	public static void main(String[] args) {

		Document doc;
		try {

			// get all images
			doc = Jsoup
					.connect(
							"http://tratu.vietgle.vn/hoc-tieng-anh/cap-cau-song-ngu/vietgle-tra-tu/tat-ca/trang-4.html")
					.get();
			// p10l icham
			
			Elements byClass = doc.getElementsByClass("icham");
			Elements byClass_vi = doc.getElementsByClass("p10l");
			for (Element byClas : byClass) {
				System.out.println(byClas.ownText());

			}
			for (Element byClass_vi_e : byClass_vi) {
				System.out.println(byClass_vi_e.ownText());

			}
//			for (int i = 0; i < byClass_vi.size(); i++) {
//				System.out.println(byClass_vi.text());
//			}
			// System.out.println(byIds);

			// Elements images = doc.select("img[src~=(?i)\\.(png|jpe?g|gif)]");
			// for (Element image : images) {
			//
			// System.out.println("\nsrc : " + image.attr("src"));
			// System.out.println("height : " + image.attr("height"));
			// System.out.println("width : " + image.attr("width"));
			// System.out.println("alt : " + image.attr("alt"));
			//
			// }

		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}
